package com.jake.bpm.controller;

import com.jake.common.constant.KeyConstants;
import com.jake.common.constant.UrlConstants;
import com.jake.common.util.HttpClientUtils;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping(value = "attendance")
public class AttendanceController {

    @PostMapping(value = "record")
    public Map<String, Object> getAttendanceRecord(@RequestBody Map<String, Object> requestMap) {
        Map<String, Object> responseMap = HttpClientUtils.getResponseMap(requestMap, UrlConstants.RABBIT_API_URL);
        if (!CollectionUtils.isEmpty(responseMap)) {
            responseMap.remove(KeyConstants.RESPONSE_ID);
            responseMap.remove(KeyConstants.RESPONSE_QUEUE_NUMBER);
        }
        return responseMap;
    }

}
